load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//pkg/testutils:buildutil/buildutil.bzl", "disallowed_imports_test")

filegroup(
    name = "testdata",
    srcs = glob(["testdata/**"]),
    visibility = ["//pkg/sql/sem/eval/eval_test:__subpackages__"],
)

go_library(
    name = "eval",
    srcs = [
        "binary_op.go",
        "cast.go",
        "comparison.go",
        "const.go",
        "context.go",
        "deps.go",
        "doc.go",
        "expr.go",
        "generators.go",
        "indexed_vars.go",
        "json.go",
        "match.go",
        "math.go",
        "overload.go",
        "parse_doid.go",
        "settings.go",
        "testing_knobs.go",
        "tuple.go",
        "unary_op.go",
        "unsupported_types.go",
        "window_funcs.go",
        "window_funcs_util.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/sem/eval",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/clusterversion",
        "//pkg/geo",
        "//pkg/geo/geopb",
        "//pkg/inspectz/inspectzpb",
        "//pkg/jobs/jobspb",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver/concurrency/isolation",
        "//pkg/kv/kvserver/kvserverbase",
        "//pkg/repstream/streampb",
        "//pkg/roachpb",
        "//pkg/security/username",
        "//pkg/server/telemetry",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/lex",
        "//pkg/sql/parser",
        "//pkg/sql/pgrepl/lsn",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/pgwire/pgnotice",
        "//pkg/sql/pgwire/pgwirecancel",
        "//pkg/sql/privilege",
        "//pkg/sql/sem/builtins/builtinsregistry",
        "//pkg/sql/sem/cast",
        "//pkg/sql/sem/catid",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sem/tree/treebin",
        "//pkg/sql/sem/tree/treecmp",
        "//pkg/sql/sem/tree/treewindow",
        "//pkg/sql/sessiondata",
        "//pkg/sql/sessiondatapb",
        "//pkg/sql/sqlerrors",
        "//pkg/sql/sqlliveness",
        "//pkg/sql/sqltelemetry",
        "//pkg/sql/types",
        "//pkg/storage/enginepb",
        "//pkg/util",
        "//pkg/util/arith",
        "//pkg/util/bitarray",
        "//pkg/util/cidr",
        "//pkg/util/duration",
        "//pkg/util/encoding",
        "//pkg/util/hlc",
        "//pkg/util/json",
        "//pkg/util/mon",
        "//pkg/util/randutil",
        "//pkg/util/rangedesc",
        "//pkg/util/ring",
        "//pkg/util/timeofday",
        "//pkg/util/timeutil",
        "//pkg/util/timeutil/pgdate",
        "//pkg/util/tochar",
        "//pkg/util/tracing",
        "//pkg/util/trigram",
        "//pkg/util/tsearch",
        "//pkg/util/ulid",
        "//pkg/util/uuid",
        "//pkg/util/vector",
        "@com_github_cockroachdb_apd_v3//:apd",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_lib_pq//oid",
    ],
)

go_test(
    name = "eval_test",
    srcs = [
        "cast_map_test.go",
        "cast_test.go",
        "compare_test.go",
        "eval_internal_test.go",
        "eval_test.go",
        "like_test.go",
        "match_test.go",
        "parse_doid_test.go",
        "timeconv_test.go",
        "window_funcs_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":eval"],
    deps = [
        "//pkg/kv",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver/concurrency/isolation",
        "//pkg/roachpb",
        "//pkg/settings/cluster",
        "//pkg/sql/faketreeeval",
        "//pkg/sql/opt/exec/execbuilder",
        "//pkg/sql/opt/optbuilder",
        "//pkg/sql/opt/xform",
        "//pkg/sql/parser",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/randgen",
        "//pkg/sql/sem/builtins",
        "//pkg/sql/sem/cast",
        "//pkg/sql/sem/normalize",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sem/tree/treecmp",
        "//pkg/sql/sem/tree/treewindow",
        "//pkg/sql/sem/volatility",
        "//pkg/sql/types",
        "//pkg/testutils",
        "//pkg/testutils/datapathutils",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/randutil",
        "//pkg/util/stop",
        "//pkg/util/timeofday",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_apd_v3//:apd",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_lib_pq//oid",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)

disallowed_imports_test(
    src = "eval",
    disallowed_list = [
        "//pkg/sql/catalog",
    ],
)
